package com.atguigu.lease.web.app.service.impl;

import com.atguigu.lease.model.entity.LabelInfo;
import com.atguigu.lease.model.entity.ViewAppointment;
import com.atguigu.lease.web.app.mapper.ViewAppointmentMapper;
import com.atguigu.lease.web.app.service.ViewAppointmentService;
import com.atguigu.lease.web.app.vo.apartment.ApartmentItemVo;
import com.atguigu.lease.web.app.vo.appointment.AppointmentDetailVo;
import com.atguigu.lease.web.app.vo.appointment.AppointmentItemVo;
import com.atguigu.lease.web.app.vo.graph.GraphVo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @author liubo
 * @description 针对表【view_appointment(预约看房信息表)】的数据库操作Service实现
 * @createDate 2023-07-26 11:12:39
 */
@Service
public class ViewAppointmentServiceImpl extends ServiceImpl<ViewAppointmentMapper, ViewAppointment>
        implements ViewAppointmentService {


    @Autowired
    private ViewAppointmentMapper viewAppointmentMapper;


    @Override
    public BigDecimal getMinRentById(Long id) {
        return viewAppointmentMapper.getMinRentById(id);

    }

    //     根据ID查询预约详情信息
    @Override
    public AppointmentDetailVo getDetailById(Long id) {

        AppointmentDetailVo appointmentDetailVo = viewAppointmentMapper.getDetailById(id);

        BigDecimal minRent = getMinRentById(id);
        appointmentDetailVo.getApartmentItemVo().setMinRent(minRent);

        return appointmentDetailVo;


    }

    /***
     *  查询个人预约看房列表
     * @return
     */
    @Override
    public List<AppointmentItemVo> selectAppointmentItem() {

        List<AppointmentItemVo> appointmentItemVoList = viewAppointmentMapper.selectAppointmentItem();


        return appointmentItemVoList;
    }
}




